fix bugs in audio funciton