moved writeable check to flush with data