Fix history handling to not push states which are already current