Hopefully fixes for #47 and #48 in one go