Fix some of issues spotted by Katarn, references #32