Appearently some versions of php do not like an array derefernce after a function call so I changed it