bugfix: fix insert + clear code  including test cases.

Signed-off-by: Kim Kulling <kim.kulling@googlemail.com>