fixed oreder for write call