add tests #1
fix algorithm #1