Fix bug in type checking for lists