bugfix for issue #312