Fix some code smells revealed by Landscape.io