Apply f5170bb to ja tree
[WIP] Apply #750 #787 to ja tree

Also applied 038f1f0 as it is related to those two pull requests.