Fix NullPointerException when reading from S3