fixed append function and renamed math to mmath to stop clashes with libc