Handle short writes; update Makefile