added missing code for swap.c