Fixes to make get_weights work