some bugfixing and slight polishing