Fixes #156 and fixes #157