fixed a bug with min_fap==0, which threw errors. Now the code handles this (rare?) case better