bugfix from Chi Xian