Fix detail view bugs and session expire bugs