Fixing some JavaScript bugs.