Some bugfixing