Complex test added, bug fixed