Fix for #33 and #36