fixed code for additional type checking