Get rid of dangerous and unnecessary cast