Fix center function