Code fixes to librepsheet.c