Length cast fix