Added error handling for invalid argument to attr-method