added some tests and minor fix [#7]