added debug print
fixed negative value errors