fixed redirecting for viewing and editing