Orders function troubleshooting