bug fixes cleanup js