several bug-fixes