replaced $.extend() with own extend() function

Quick and dirty, but should work.