more *BSD things, more debug prints, use FREAD etc consistently