Bug fixes

Fixed a bug where the first row would stay filled with numbers. Also
fixed a bug where the last row would not be filled properly.