buggy control flow