Changes

- Fix race condition in api.py
- Add config option