Bug fixes in create_order