fixed bugs in some functions, got some packet constuctors