minor bugfixing and polishing