Fix bug when creating orders