fixed a bug which could crash the OS and added memory pool support for LwIP