Fixing js bugs after merge