prepared statements; connection closed bug fixed