Fixing couple of bugs