Remove widening conversion that could lead to classcastexception