damn...
my bad.
damn. should have checked right away.
had commented out the valid lines when wanted to quickly test possible shorter resolutions

so, your code indeed worked fine.
sorry.