Fix code to allow insertion withot crashing + implement questionnaire insert