Add some more datatype checks, patch by Eugene C., #499