fixed graph function