Merge of #772 and master

Fixed conflicts in #772 and master