Various fixes, add config loading