fixed bugs in compiler; added test to contract