improved datatype error handling