Corrected bug with complex nested references