diff --git a/apps/user_ldap/lib/access.php b/apps/user_ldap/lib/access.php
index 32472c13b035dd26a1d00fb08f9d9850ccf8cb53..dd8ffe14bcaea0fcfd0e49357ebf0292af0027c1 100644
--- a/apps/user_ldap/lib/access.php
+++ b/apps/user_ldap/lib/access.php
@@ -691,8 +691,9 @@ class Access extends LDAPUtility implements user\IUserTools {
 	 * @param array $ldapRecords
 	 */
 	public function batchApplyUserAttributes(array $ldapRecords){
+		$displayNameAttribute = strtolower($this->connection->ldapUserDisplayName);
 		foreach($ldapRecords as $userRecord) {
-			$ocName  = $this->dn2ocname($userRecord['dn'][0], $userRecord[$this->connection->ldapUserDisplayName]);
+			$ocName  = $this->dn2ocname($userRecord['dn'][0], $userRecord[$displayNameAttribute]);
 			$this->cacheUserExists($ocName);
 			$user = $this->userManager->get($ocName);
 			$user->processAttributes($userRecord);
diff --git a/apps/user_ldap/lib/user/user.php b/apps/user_ldap/lib/user/user.php
index c77f7254c948acaf939ce5b1a2fd22ad2c0a4ce0..0dc3c8c0c26465ca8d450e96c5ad76506e870106 100644
--- a/apps/user_ldap/lib/user/user.php
+++ b/apps/user_ldap/lib/user/user.php
@@ -417,9 +417,9 @@ class User {
 		}
 		//can be null
 		$quotaDefault = $this->connection->ldapQuotaDefault;
-		$quota = !is_null($valueFromLDAP)
-			? $valueFromLDAP
-			: $quotaDefault !== '' ? $quotaDefault : null;
+		$quota = $quotaDefault !== '' ? $quotaDefault : null;
+		$quota = !is_null($valueFromLDAP) ? $valueFromLDAP : $quota;
+
 		if(is_null($valueFromLDAP)) {
 			$quotaAttribute = $this->connection->ldapQuotaAttribute;
 			if(!empty($quotaAttribute)) {
diff --git a/apps/user_ldap/tests/access.php b/apps/user_ldap/tests/access.php
index cb6dbf0cd5d4ab58e9d77d609852fe6d4a54a703..25e871d9b3da89714e62fd723da25aa789a8296b 100644
--- a/apps/user_ldap/tests/access.php
+++ b/apps/user_ldap/tests/access.php
@@ -230,24 +230,34 @@ class Test_Access extends \Test\TestCase {
 		$mapperMock = $this->getMockBuilder('\OCA\User_LDAP\Mapping\UserMapping')
 			->disableOriginalConstructor()
 			->getMock();
+
+		$mapperMock->expects($this->any())
+			->method('getNameByDN')
+			->will($this->returnValue('a_username'));
+
 		$userMock = $this->getMockBuilder('\OCA\user_ldap\lib\user\User')
 			->disableOriginalConstructor()
 			->getMock();
 
+		$access->connection->expects($this->any())
+			->method('__get')
+			->will($this->returnValue('displayName'));
+
 		$access->setUserMapper($mapperMock);
 
+		$displayNameAttribute = strtolower($access->connection->ldapUserDisplayName);
 		$data = array(
 			array(
 				'dn' => 'foobar',
-				$con->ldapUserDisplayName => 'barfoo'
+				$displayNameAttribute => 'barfoo'
 			),
 			array(
 				'dn' => 'foo',
-				$con->ldapUserDisplayName => 'bar'
+				$displayNameAttribute => 'bar'
 			),
 			array(
 				'dn' => 'raboof',
-				$con->ldapUserDisplayName => 'oofrab'
+				$displayNameAttribute => 'oofrab'
 			)
 		);
 
diff --git a/apps/user_ldap/tests/user/user.php b/apps/user_ldap/tests/user/user.php
index 1c41eb71ec2785d10f5efcbadd51cbef4d34b614..19581d835d1f8769df8c9eb5a8136eb43af6a5f6 100644
--- a/apps/user_ldap/tests/user/user.php
+++ b/apps/user_ldap/tests/user/user.php
@@ -370,6 +370,45 @@ class Test_User_User extends \Test\TestCase {
 		$user->updateQuota();
 	}
 
+	public function testUpdateQuotaFromValue() {
+		list($access, $config, $filesys, $image, $log, $avaMgr, $dbc) =
+			$this->getTestInstances();
+
+		list($access, $connection) =
+			$this->getAdvancedMocks($config, $filesys, $log, $avaMgr, $dbc);
+
+		$readQuota = '19 GB';
+
+		$connection->expects($this->at(0))
+			->method('__get')
+			->with($this->equalTo('ldapQuotaDefault'))
+			->will($this->returnValue(''));
+
+		$connection->expects($this->once(1))
+			->method('__get')
+			->with($this->equalTo('ldapQuotaDefault'))
+			->will($this->returnValue(null));
+
+		$access->expects($this->never())
+			->method('readAttribute');
+
+		$config->expects($this->once())
+			->method('setUserValue')
+			->with($this->equalTo('alice'),
+				$this->equalTo('files'),
+				$this->equalTo('quota'),
+				$this->equalTo($readQuota))
+			->will($this->returnValue(true));
+
+		$uid = 'alice';
+		$dn  = 'uid=alice,dc=foo,dc=bar';
+
+		$user = new User(
+			$uid, $dn, $access, $config, $filesys, $image, $log, $avaMgr);
+
+		$user->updateQuota($readQuota);
+	}
+
 	//the testUpdateAvatar series also implicitely tests getAvatarImage
 	public function testUpdateAvatarJpegPhotoProvided() {
 		list($access, $config, $filesys, $image, $log, $avaMgr, $dbc) =