refactor getRoleById, fix bugs