Also ensure that default closest_safe and closest_unsafe values are defined in cast_motion() and before cast_motion() is called.