Fixed bug where 500 error occured if deleting items from history.