fixed some bugs with integration