Database: typo
Database: fixed comparing result-set keys [Closes #936]

Php tends to somehow shuffle array keys in case of bigger result-set