fixed araqne/issue#18. modified from-to check logic