small fixes and code-cleanup