Fixes for errors found by gcc