Fixed stupid bugs in integral