Fixed prepared statement bug