Java changes for 500 error on both downloading and requesting