Add the same patch as in the develop branch issue162 and issue163