Fixed pass by reference stuff so that it works in PHP 5.4