fixes #2 and #12