add -Wall flag and fix warnings