fix overwrite flag

Fix overwrite flag with new flag without ":". $val was always empty because $flag was overwrite with new value.