Fix small Javascript bugs