fixes #144 and #177