fixes location control flow