Fix to bug pointed out by Nick.