fixed problems in javascript