Fix for non existing row in database and empty lines