Fixed (various) bugs