Fix for HABTM relations bug