Implemented fix for #560