exception handling fixing #6