partial fix for #24, blocked by #25