Fixed the TOPDIR calculations, which didn't work under Linux.