lots of bug fixes with date formatting