fix trail detection problem