fixed the way fields are retrieved after mysql query