small bug in javascript