Fixed reference to global $ variable