Fix error if result empty or undefined (Database)