Null checks

Hope this fixes things with #172 - not sure why most of these were removed...