Fix for #86 & #117