Fixed some js errors
Fixed occasionally removed code