#357 handle error scenarios
#421 reproduced in test
#421 fixed and reproduced in AlterTest
#421 polished
#421 polished
Merge pull request #422 from krzyk/357

#422: pull request #357 handle error scenarios