fix wrong type checking