Resolve the bug part of #305