some bugfixes for plugin loading order