fix incorrect nesting, leading to failed month detection, add test case from issue #125