add debug flags and optimization