bugfixes for issue 1