Address comments and fix bug