Fixes pointed out by @zrax and @hoikas.