Fixed issues with packets

Packets could not be constructed. Code added to fix this.