Fix rare bug of pages not being invalidated properly