adding minor error handling + new test