bug in color filtering, and added param for mode