Add readline support to the application.

Fixed some minor errors that were introduced due to using readline.