resolve optimizations (^peter)
(cherry picked from commit 44d8fa3)