fix bugs that show up on compile to js