Fixed bugs in audio frame handling