fixing JavaScript