Fixing ternary operator for PHP 5.2