Fix error in naive integrate function