some aes and debug fixes