Fixed bug: total was cast to int