Tried to fix some bugs with magma.