Bug fixes, not finished