added type checking and NSDate now works.