improved handling of request_dir path in main.py