Fix shadow declaration in unittest and illegal implicit casts