Added root check and proper error returns