fix the issue that no error occurs when an invalid type is specified