changing cb check to check against function type instead of undefined