FIxed cast issues.