fix startkey/endkey backwards representation

http://manage.dimagi.com/default.asp?114134