Bug fix patch pack

A few minor bug fixes, and one major one for the AP controller script.