this fixes #297 and #91