Fixed NPE in obj attribute sort