Issues #562 and #570 fixed