Removed bug from berkeley function
Added import statement for gates