Fix mostly harmless issues spotted by the static analysis tool