Added check in case itemname returned nil