bug fixes

wrong "end }" fixed
#406 fixed