copied from JActor2