db cursor error fixed