Added checks for expectation function.