fixed 2 segaults