fixed ruby code