Blog: db query bugfixes