fix bug with insertion of newline being wrong if the num function was used at