fix timerfunction and change otherlayer to midlayer