Fixed some casting issues.