added unpacking function to server