fixed control flow error