Did some bugfixing