works but can not exit play() function