fix handling lastvalidposition with isvalid strict