Updated init_flag function + indices correction in sor, uvp