fixed a bug in teardown() function and tri-stated PE drivers