fix build, missing includes for memcpy
fix: possible buffer overflow, fix:  connection without database