Made logging optional
Check for frames with length exceeding integer limit