compile with "-O2 -Wall -Werror" and fix errors