throw was in wrong place