Fix for by-week query, and some convenience macros.