Fixed potential undefined slope bug