Fixed a bug that would crash the database due to open cursor and started to otimize database searches.