fix relation in/out direction

Signed-off-by: Lars Martin <lars.martin@smb-tec.com>
add some more tests

Signed-off-by: Lars Martin <lars.martin@smb-tec.com>