Changed input prev character to null terminator