merged from develop, added fix for #627