code cleanup / bug-fix