Fixed extend() method