Bug fixed division 0 in SwapMemory()