fix #49 (a little code optimizing)