bug fixing

fixed a bug in code