bug fixing recursive