Fixed bugs that were introduced in 45443e0371 , and fixed #5.