refactor getsize sync function