Fixes variable. Also fixes #3131