ported #100 to master