remove debug statement and fix cast length check