fix bugs that assignment to unwritable global variable changed the value