rel.bottom was negative for small windows, so substracting offset didn't work properly