handling edge cases of extend