this fixes #333
split in 2 as part of fix to #333