Fix bug, when item appears with null id in purchase table.