added the check of the result of select, not only for empty but also for too many.