Fixed missing cookie functionality.
Added function to clear all open buffers when there is an error.