Optimised the code a bit
fixed the same bug for dropdown boxes and radiobuttons