Fix centerOn function