added "invert" argument to reliability