fixed a bug in the maxabs selection function