diff --git a/apps/contacts/ajax/currentphoto.php b/apps/contacts/ajax/currentphoto.php
index 15cb6c7a083a5e98cae849ba6f6f1e4169587bbe..171f5c347858309a9e4f9dd9afca33f1d6bffcb7 100644
--- a/apps/contacts/ajax/currentphoto.php
+++ b/apps/contacts/ajax/currentphoto.php
@@ -20,7 +20,7 @@
  *
  */
 // Init owncloud
-require_once('../../../lib/base.php');
+//require_once('../../../lib/base.php');
 
 // Check if we are a user
 // Firefox and Konqueror tries to download application/json for me.  --Arthur
diff --git a/apps/contacts/ajax/oc_photo.php b/apps/contacts/ajax/oc_photo.php
index 14d77ea50b77844511edba39e4978bad43b2f115..e46441c48210cdde90dd66ab13b2d48472d83fbe 100644
--- a/apps/contacts/ajax/oc_photo.php
+++ b/apps/contacts/ajax/oc_photo.php
@@ -20,7 +20,7 @@
  *
  */
 // Init owncloud
-require_once('../../../lib/base.php');
+require_once('lib/base.php');
 
 // Check if we are a user
 // Firefox and Konqueror tries to download application/json for me.  --Arthur
@@ -36,11 +36,11 @@ function debug($msg) {
 	OC_Log::write('contacts','ajax/oc_photo.php: '.$msg, OC_Log::DEBUG);
 }
 
-if (!isset($_GET['id'])) {
+if(!isset($_GET['id'])) {
 	bailOut(OC_Contacts_App::$l10n->t('No contact ID was submitted.'));
 }
 
-if (!isset($_GET['path'])) {
+if(!isset($_GET['path'])) {
 	bailOut(OC_Contacts_App::$l10n->t('No photo path was submitted.'));
 }
 
@@ -66,7 +66,7 @@ if(!$image->fixOrientation()) { // No fatal error so we don't bail out.
 	debug('Couldn\'t save correct image orientation: '.$tmpfname);
 }
 if($image->save($tmpfname)) {
-	OC_JSON::success(array('data' => array('mime'=>$_SERVER['CONTENT_TYPE'], 'name'=>$fn, 'id'=>$id, 'tmp'=>$tmpfname)));
+	OC_JSON::success(array('data' => array('id'=>$_GET['id'], 'tmp'=>$tmpfname)));
 	exit();
 } else {
 	bailOut('Couldn\'t save temporary image: '.$tmpfname);
diff --git a/apps/contacts/js/contacts.js b/apps/contacts/js/contacts.js
index 7333b0e8d42271f52689d151bcc8c9dcb2ccb648..ba8e08fd8755b676839af7d56258fc73081a3f6b 100644
--- a/apps/contacts/js/contacts.js
+++ b/apps/contacts/js/contacts.js
@@ -1066,6 +1066,9 @@ Contacts={
 			},
 			loadPhotoHandlers:function(){
 				$('#phototools li a').tipsy();
+				$('#phototools li a').click(function() {
+					$(this).tipsy('hide');
+				});
 				$('#contacts_details_photo_wrapper').hover(
 					function () {
 						$('#phototools').slideDown(200);
diff --git a/apps/contacts/templates/part.contact.php b/apps/contacts/templates/part.contact.php
index a35d38e8867434cde8546d9c5d57c0920da2faa3..bbe201433256632e4cf0612eb7be2a1593565f89 100644
--- a/apps/contacts/templates/part.contact.php
+++ b/apps/contacts/templates/part.contact.php
@@ -23,7 +23,7 @@ $id = isset($_['id']) ? $_['id'] : '';
 
 	<div id="contact_photo" class="contactsection">
 
-	<form class="float" id="file_upload_form" action="ajax/uploadphoto.php" method="post" enctype="multipart/form-data" target="file_upload_target">
+	<form class="float" id="file_upload_form" action="<?php echo OC_Helper::linkTo('contacts', 'ajax/uploadphoto.php'); ?>" method="post" enctype="multipart/form-data" target="file_upload_target">
 		<div class="tip propertycontainer" id="contacts_details_photo_wrapper" title="<?php echo $l->t('Click or drop to upload picture'); ?> (max <?php echo $_['uploadMaxHumanFilesize']; ?>)" data-element="PHOTO">
 		<!-- img style="padding: 1em;" id="contacts_details_photo" alt="Profile picture"  src="photo.php?id=<?php echo $_['id']; ?>" / -->
 		<progress id="contacts_details_photo_progress" style="display:none;" value="0" max="100">0 %</progress>
diff --git a/apps/contacts/templates/part.importaddressbook.php b/apps/contacts/templates/part.importaddressbook.php
index 3efb90cd2201acc8f239011e0df6ac6286e71b4f..2db23368866a573beafab16332bb95de338082ed 100644
--- a/apps/contacts/templates/part.importaddressbook.php
+++ b/apps/contacts/templates/part.importaddressbook.php
@@ -22,7 +22,7 @@
 	</td>
 </tr>
 </table>
-<form id="import_upload_form" action="ajax/uploadimport.php" method="post" enctype="multipart/form-data" target="import_upload_target">
+<form id="import_upload_form" action="<?php echo OC_Helper::linkTo('contacts', 'ajax/uploadimport.php'); ?>" method="post" enctype="multipart/form-data" target="import_upload_target">
 <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $_['uploadMaxFilesize'] ?>" id="max_upload">
 <input id="import_upload_start" type="file" accept="text/*" name="importfile" />
 <input id="close_button" style="float: left;" type="button" onclick="Contacts.UI.Addressbooks.cancel(this);" value="<?php echo $l->t("Cancel"); ?>">
diff --git a/apps/files/ajax/rawlist.php b/apps/files/ajax/rawlist.php
index 8f1990d1b8ff694a4bbb87123bacc03e4094bd21..0b37b93674f995f8d1a61fac336108fe913339b5 100644
--- a/apps/files/ajax/rawlist.php
+++ b/apps/files/ajax/rawlist.php
@@ -5,7 +5,7 @@ $RUNTIME_APPTYPES=array('filesystem');
 
 // Init owncloud
 
-require_once('../../lib/template.php');
+require_once('lib/template.php');
 
 OC_JSON::checkLoggedIn();
 
diff --git a/core/js/oc-dialogs.js b/core/js/oc-dialogs.js
index 6a3dac02ea7fb78a7ff4bc4467f4c82e8859113d..7e41c1a7a593d62eab0a315500845156b4d9c1b5 100644
--- a/core/js/oc-dialogs.js
+++ b/core/js/oc-dialogs.js
@@ -240,6 +240,6 @@ OCdialogs = {
     var newval = parseInt($(dcid + ' #dirtree option:last').val())+1;
     $(dcid + ' #dirtree').append('<option selected="selected" value="'+newval+'">'+name+'</option>');
     $(dcid + ' .filepicker_loader').css('visibility', 'visible');
-    $.getJSON(OC.webroot+'/files/ajax/rawlist.php', {dir: p, mimetype: $(dcid).data('mimetype')}, function(r){OC.dialogs.fillFilePicker(r, dcid)});
+    $.getJSON(OC.filePath('files', 'ajax', 'rawlist.php'), {dir: p, mimetype: $(dcid).data('mimetype')}, function(r){OC.dialogs.fillFilePicker(r, dcid)});
   }
 };