bugfix Issue #5

this fixes some other various bugs too (Issue #5)