Bugfixes and framework for backwards compatibility