added readasdataurl function and fixed which radio button is pre-selected