Fixed zero weight issue. It is still not correct though