fix: unused variables has been removed and global variable err changed to local variable.