Fix weight bug

Fix bug reported in #44