somewhat crude but hopefully functional fix
fixes #819