JS type detect fix