This fixes #1 and fixes #2