got rid of nanmask code, speedup
resolved trivial conflict