Fix looping issue when deploying