fixing Class Cast Exception