Updated code for latest stable realease 2.5.1