fixed StypeOf function