Added length check