Fixed #766 - setting cookies on empty page throws an exception