Grid and its iterator tested, fix related bugs.