Court overturns gun conviction of man imprisoned for 4 years