Fix bugs spotted by landscape.io's prospector