added statement termination checks