not DRY but fixes #109