Error handling improvements

Some error handling improvements in grid slicing and replaced variable
== None with variable is None