Fixed some issues with habtm saving