added compatibility for rails 2