stage 2 bugfixing