compile with gcc47 and fix errors for it