bug fixes (final patch hopefully)