fix trip detection