fixed square overwrite bug