Fix percent routine bug and buffer length bug in mode line