improved trajectory check, minor fixes