Fixes #1042

Feel free to change if need. I will be away for couple of days.