Fix bug in photo javascript