Finally found the errors. casting and constructor