Make sure geom!=null
Add better tests