core-4736 refactor code. fix error dialog