1.5.x -  #114 - GSLayerEncoder21 fix

here is the backport for 1.5.x