The problem is that when I first select an album it does fetch all relative images. However, when I select another album it throws an OAuthException: An active access token must be used to query information about the current user.
It seems that creating a new $facebook object in fetch_data.php causes this.