fix several tests and functions (including beta-reduction)