found a bug in matlab version of f3