Some bugfixes in ServiceProvider