make performance better, fix issue #13

thanks to adonis0147