Fix a weird bug and optimize code

No, let's retrieve it each time