Fixed various error handling.
Fixed where it would just crash when AMI went away, now it will respawn itself and try again when there is an AMI problem.