fixed bug which caused copying declaration type before cycle was resolved