Fix exceptions on startup

Used propertiesUtil instead of direct casts.
added apache license header