fix reference bug in js