More pframe_dirty error handling
Added error checking in do_write and do_read