tiny refactor & fix resource limit