fixed some miscellaneous API mismatches in different places. Set some corner case handling for the logged_in_users counter (don't let it go below zero)