minor bugfixes & readability improvements