Add some object checks.  Fix return type