another attempt to fix trail code