fixes #246 and #233