Feature/fix for supervisor

WIP. I'm still doing final testing, there might be more problems.