Added type validation to length expression