Fixing bug with null types throwing NullPointerExceptions - specifically in the date.getTime() method