Bunch of small fixes (coding style, very unlikely errors, warning messages)