fixed minor bug in code