This fixes #1 and fixes #4.