Collecting treasury resources when storage is full? [duplicate]

I waited long to make space in my gold storage. Then when transfered the extra elixir and dark elixir was still there in my castle. I found 0 gold, 22k elixir and 4 dark elixir in my castle after I transfered resources.