Fix for #260 and #238