Switch to PDO and Bug Fix