diff --git a/core/avatar/controller.php b/core/avatar/controller.php
index 5264327b6410427b5edd51551f9196162af46ad6..50ec50f19a56ad47b8edaccee6061b2714cc39a6 100644
--- a/core/avatar/controller.php
+++ b/core/avatar/controller.php
@@ -72,12 +72,14 @@ class OC_Core_Avatar_Controller {
 			} else {
 				$l = new \OC_L10n('core');
 				$type = substr($image->mimeType(), -3);
-				if ($type === 'peg') { $type = 'jpg'; }
+				if ($type === 'peg') {
+					$type = 'jpg';
+				}
 				if ($type !== 'jpg' && $type !== 'png') {
 					\OC_JSON::error(array("data" => array("message" => $l->t("Unknown filetype")) ));
 				}
 
-				if (!$img->valid()) {
+				if (!$image->valid()) {
 					\OC_JSON::error(array("data" => array("message" => $l->t("Invalid image")) ));
 				}
 			}
diff --git a/lib/avatar.php b/lib/avatar.php
index 9b2a7fe07cf03ba36e52024bbbe0a8c0a84816b8..5f73a9bf220261900a7a153c434163f5d553c1c6 100644
--- a/lib/avatar.php
+++ b/lib/avatar.php
@@ -15,7 +15,7 @@ class OC_Avatar {
 	 * @brief get the users avatar
 	 * @param $user string which user to get the avatar for
 	 * @param $size integer size in px of the avatar, defaults to 64
-	 * @return mixed \OC_Image containing the avatar or false if there's no image
+	 * @return boolean|\OC_Image containing the avatar or false if there's no image
 	*/
 	public function get ($user, $size = 64) {
 		$view = new \OC\Files\View('/'.$user);