fix js casting weirdness