fixed open/write error