Fix context issues. Fixes #16