Fix bug in extend