Some bugfixing in classes