Liang Gong's fix for issue #52.