changed errors to return undefined