Form field type checkbox does not work - Proposed Fix

I tried to put checkbox form fields into my custom component using xml forms. In my fieldset there is included: 

<field
	name="named_checkbox"
	type="checkbox"
	label="COM_COMPONENT_CHECKBOX_LABEL"
	description="COM_COMPONENT_CHECKBOX_DESC"
	class="inputbox"
	value="1"
	default="0"			
/>

The checkbox saves fine when it is checked. However when I try to uncheck the checkbox, it does not update the database. After this change any checkbox form element should save value 0 when the checkbox is unchecked.