Miscellaneous JS fixes