On almost periodic orbits and minimal sets