Fixed an issue where the header & footer view were called too many times

Credit goes to Boram Han