fixed immediate write bug