Fix issue 1 and 2

These two commits fix issues 1 and 2.