fixed a few bugs and switch from underscore to lodash (underscores extend() is shallow only)