Fix two functions that violate their assumed contracts