Apply Werror option and fix warning code