Only assign box number if valid. Closes #136