Hourly rates are a way of shifting scope risk from the worker to the employer. Do hourly work if you have no idea how long it will take, the project variability, or your risks of being unable to complete it. Otherwise, as you said, do the project for a fixed price.