updated error messages and added object id checking