fixed space errors in allocation