Fixes small Bug and adds Unit Tests