necessary changes for #294 + #351