fixing js bug