Fixed bug in applayer