Added a panic and re-arranged logic for or go version 1.0.3 compatibility.