Fixing seg fault in #380