improve block begin/end behavior