Fix end check