Closed #2429: Fixed a bug of cc.Layer's bake function.

Fixed a bug of cc.Layer's bake function.