Fixes #4 and probably fixes #2