[*] bugfix for #1. Thanks to ocus@github
[~] small code style refactoring