Support org quota management

Fix some code according to the review comments.