Partial fix of #793