fixing extend logic