adjust margins and fix date calculations