The fix is simple, repopulate user 0 in users table. The fun is when MySQL automatically increment auto_increment field when you passed in '0' in the insert query. Combined this with the fact that drupal can accidentally delete user 0 in certain cases.