Should have been ValueError instead of TypeError