Bug fixes in v1 Code