Fix NullPointerException in APIConnection.