diff --git a/Usermode/Applications/Makefile.tpl b/Usermode/Applications/Makefile.tpl
index 1339765563f72b652027438ef4ad936ff0881208..542fd815c9f7a375adb8bc4c9967746ba838f519 100644
--- a/Usermode/Applications/Makefile.tpl
+++ b/Usermode/Applications/Makefile.tpl
@@ -4,7 +4,7 @@
 #
 
 CFLAGS  += -Wall -Werror -fno-builtin -fno-stack-protector -g
-LDFLAGS += 
+LDFLAGS += -g
 
 _BIN := $(OUTPUTDIR)$(DIR)/$(BIN)
 _OBJPREFIX := obj-$(ARCH)/
diff --git a/Usermode/Applications/cat_src/main.c b/Usermode/Applications/cat_src/main.c
index e63a97c15f0e6175ea74ac7eb01aef07207b5a72..a389c108649cc1bbd0ea0b3977903e1f17967296 100644
--- a/Usermode/Applications/cat_src/main.c
+++ b/Usermode/Applications/cat_src/main.c
@@ -30,6 +30,7 @@ int main(int argc, char *argv[])
 
 	do {
 		num = read(fd, buf, BUF_SIZE);
+		if(num < 0)	break;
 		buf[num] = '\0';
 		printf("%s", buf);
 	} while(num == BUF_SIZE);