photo upload code fixes