fixed couple of bugs + performance improvenments
fixed broken build