Basic linear writer and tests; fixed reading bug in fits reader