Fixed various bugs to make video/audio recording work.