Fixing blank spaces before end keywords causing crashes