bug-fix + unittest