updating page middleware