Fixed (potential) bugs