fixed bug thanks to Kannan