version of PR1236 (hotswap support) for "next" branch