Fix for #436. Thanks @swalters