Fix compilation and add good flags