added tests + fixed bugs tests revealed