fix memmove bug and add testing
Test for memmove