fixing null pointer exception during client creation