fixed null read in js