fix bug when only one record exists