Fixed errors found by compiling with gcc