fixing bug in photo upload