added typeof check to JSONp callback