Bug fix / cleanup