sync with jstar commit 8577f4a3144