Revert "only check for the JS variable 5 times"

This reverts commit ca6b53cbec7f8e6c81972082eaeb087ccd7a9fb0.