Attempt at fixing some bugs...