Fixed bad casting