Hello,
Thanks for your reply Pascal!
It now works correctly.
(Sorry for posting the code this way, I wasn't aware of it)