http://stackoverflow.com/questions/9448850/undefined-ctx-variable