Fix bug in getting last error of mysqli database driver