Added fix for calculating classpath

with test cases.