Bug fixes and cleanup

Fixes various bugs and playback issues.