Fixing openmp pragmas and bug