Fix cppcheck reports warnings:

(performance) Possible inefficient checking for 'lmap' emptiness
(warning) Assignment of function parameter has no effect outside the function. Did you forget dereferencing it?
(style) Array index '<xxx>' is used before limits check