Added unit tests for bymonth and bysetpos, and corrected issues found in the process.