Fixing logic in appendChildren methods