Fixed memory swapping error
erorr after multiple switching