Fixed compile-time and run-time errors.