Fixed issue# 766

Fixed issue #766 
Closed PR #807 as it was on a very old based version and creating a new one.