Fixed peg function to handle bad args better.