Issues #604 and #605 fixed