Fixed a bug that occured when database was empty
Extended documentation