fixing before/after queries
Merge pull request #92 from gvn/1042055

fixing before/after queries