change NSAssert to exceptions