@Gnouc You're right, I used a non-existent directory. With the correct directory it gives the right answer. Still, your code should probably complain if the file or directory does not exist.
faheem@orwell:/tmp$ stat -c "%a %n" mode stat: cannot stat `mode': No such file or directory