Assignment doesn't copy in javascript, oops