fix some error in layer controller code