fix bug reported by Thao Chu