ensure bin is valid in getElement() (hw3)