Fix sql bug in last change. Oops.