Added global, fixed bug