Some bug fixes and commentaries