fixed extend method

added tests