Bug fixes

- Improved HTML sanitisation
- Fixed bug in database class