fixed assertions to handle side effects in expressions correctly