Final fixes for variable inserting