Fixed 'cannot read property user of undefined'