Fixed bug filed on github with AAs containing structs. Also added new unit test to check for the bug