Fixes for issue #333