callback throws typeError