catch errors on changing states
remove debug output
display profile information when available
fix Printf call