correct fix of 'invalid write' errors