another small bug fix on upload.php