fixed a bug in javascript comparison