diff --git a/TODO b/TODO
index 0fed222d8de67acbab86e40e455725b356c259d0..87f93a7c270059d20026366b60c9fcbea9182908 100644
--- a/TODO
+++ b/TODO
@@ -17,3 +17,7 @@ Small list of planned features/changes, suggestions are always welcome.
   * Sort by number of files
   * Use one key to open up a menu with sort options, instead of
     having a special key for each column
+
+- Fix bugs:
+  * Handle hard links
+  * Get rid of PATH_MAX reliance
diff --git a/src/calc.c b/src/calc.c
index a1a2001d2a0d39c738110f6e0ccbfdec4fd7773e..bddab07f4e4f2ecfc0f7d16db4954dfe7687b089 100644
--- a/src/calc.c
+++ b/src/calc.c
@@ -40,6 +40,27 @@
 #include <dirent.h>
 
 
+/* set S_BLKSIZE if not defined already in sys/stat.h */
+#ifndef S_BLKSIZE
+# define S_BLKSIZE 512
+#endif
+
+#ifndef LINK_MAX
+# ifdef _POSIX_LINK_MAX
+#  define LINK_MAX _POSIX_LINK_MAX
+# else
+#  define LINK_MAX 32
+# endif
+#endif
+
+#ifndef S_ISLNK
+# ifndef S_IFLNK
+#  define S_IFLNK 0120000
+# endif
+# define S_ISLNK(x) (x & S_IFLNK)
+#endif
+
+
 struct {
   char err;                /* 1/0, error or not */
   char cur[PATH_MAX];      /* current dir/item */
diff --git a/src/ncdu.h b/src/ncdu.h
index c7bc74794e59abf79ade06f395f52b3bc158ee1d..2a3052d4aa1c8926c839f5131613468aa13f2444 100644
--- a/src/ncdu.h
+++ b/src/ncdu.h
@@ -29,11 +29,7 @@
 #include "config.h"
 #include <stdio.h>
 #include <sys/types.h>
-
-/* set S_BLKSIZE if not defined already in sys/stat.h */
-#ifndef S_BLKSIZE
-# define S_BLKSIZE 512
-#endif
+#include <limits.h>
 
 /* PATH_MAX 260 on Cygwin is too small for /proc/registry */
 #ifdef __CYGWIN__
@@ -51,21 +47,6 @@
 #  define PATH_MAX 4096
 # endif
 #endif
-/* and LINK_MAX */
-#ifndef LINK_MAX
-# ifdef _POSIX_LINK_MAX
-#  define LINK_MAX _POSIX_LINK_MAX
-# else
-#  define LINK_MAX 32
-# endif
-#endif
-/* check for S_ISLNK */
-#ifndef S_ISLNK
-# ifndef S_IFLNK
-#  define S_IFLNK 0120000
-# endif
-# define S_ISLNK(x) (x & S_IFLNK)
-#endif
 
 
 /* File Flags (struct dir -> flags) */