Fixed all relevant bugs