fixing some error handling, and config loading + tests