Issues #459 and #500 fixed