Fix for crash when adding new item.