port fix for #16 to master