Move check for scrollDisplace up in the code

Before displace is defined