kotlinc-jvm/kotlinc-js fixes

As requested, this is a squashed version of #266.