Issue #318, 563, 564 fixed