fix yvt/openspades#266
implement yvt/openspades#249
Merge pull request #274 from barzoj/master

fix yvt/openspades#266