Fixed ofgwrite and some stuff for gbip (thx to arn354)