Added rectangular target support, handle miss the target.

fixed minor bugs