Moved get_header() to after the declaration of $mode.