Fix for #227 and #230