fixed an edge case bug, made tests more generic