diff --git a/core/avatar/controller.php b/core/avatar/controller.php
index 50ec50f19a56ad47b8edaccee6061b2714cc39a6..d0edde506476eb42febd8af3955d9bb680792637 100644
--- a/core/avatar/controller.php
+++ b/core/avatar/controller.php
@@ -33,7 +33,7 @@ class OC_Core_Avatar_Controller {
 		if ($image instanceof \OC_Image) {
 			\OC_Response::setETagHeader(crc32($image->data()));
 			$image->show();
-		} elseif ($image === false) {
+		} else {
 			\OC_JSON::success(array('user' => $user, 'size' => $size));
 		}
 	}
@@ -45,9 +45,7 @@ class OC_Core_Avatar_Controller {
 			$path = stripslashes($_POST['path']);
 			$view = new \OC\Files\View('/'.$user.'/files');
 			$newAvatar = $view->file_get_contents($path);
-		}
-
-		if (!empty($_FILES)) {
+		} elseif (!empty($_FILES)) {
 			$files = $_FILES['files'];
 			if (
 				$files['error'][0] === 0 &&
@@ -57,6 +55,10 @@ class OC_Core_Avatar_Controller {
 				$newAvatar = file_get_contents($files['tmp_name'][0]);
 				unlink($files['tmp_name'][0]);
 			}
+		} else {
+			$l = new \OC_L10n('core');
+			\OC_JSON::error(array("data" => array("message" => $l->t("No image or file provided")) ));
+			return;
 		}
 
 		try {
@@ -101,8 +103,6 @@ class OC_Core_Avatar_Controller {
 	}
 
 	public static function getTmpAvatar($args) {
-		$user = OC_User::getUser();
-
 		$tmpavatar = \OC_Cache::get('tmpavatar');
 		if (is_null($tmpavatar)) {
 			$l = new \OC_L10n('core');
diff --git a/lib/public/avatar.php b/lib/public/avatar.php
deleted file mode 100644
index 6da8e83a9af8a389966e38cb093f2b328df6f7ac..0000000000000000000000000000000000000000
--- a/lib/public/avatar.php
+++ /dev/null
@@ -1,12 +0,0 @@
-<?php
-/**
- * Copyright (c) 2013 Christopher Schäpers <christopher@schaepers.it>
- * This file is licensed under the Affero General Public License version 3 or
- * later.
- * See the COPYING-README file.
- */
-
-namespace OCP;
-
-class Avatar extends \OC_Avatar {
-}