added error checker for top method