Minor improvements

Added handling for mis-types.