Added length check on cleanup