Fixed bug #180 as suggested, changing xxx.constructor == Function to typeof xxx ...