corrected errors in code