bug fix for #501