Fix some problems in spreadsheet.pl