fix for issue #255; some other fixes