fixed typeof() was uncorrectly used