using NSError instead of NSAssert