fixed error where date undefined calls a method.