Fix for issues 417 and 465