fix incorrect behaviour
add tests