Slightly logic modified if no record found