Fixes several bugs in Calendar implementation