Fixes two bugs