Better handling for partial writes